package com.gouaixin.bee.beeframework2.tool;

import android.content.Context;
import android.webkit.WebView;

/**
 * Created by Administrator on 2015/4/24.
 */
public class HtmlUtil {

    public static void loadHtmlFromAssets(Context context,WebView webView,String fileName) {

//		String


        //读取本地的html
        String html = "";
        try {
            html = FileUtils.readAssest(context, fileName);
            mLog.e("html：" + html);
            mLog.e("WebViewActivity:转化之前的html=" + html);
        } catch (Exception e) {
            mLog.e("html：失败" + e.getMessage());
        }



//        html = html.replace("@fontName0", "Impact");
//        html = html.replace("@fontName1", "STANK");
//        html = html.replace("@fontPath0", "../font/Impact.ttf");// assets相对路径
//        html = html.replace("@fontPath1", "file://" + folder + "font/STANK.ttf");// sd卡里的ttf文件绝对路径
//
//        html = html.replace("@image_assets", "image0.png");
//        html = html.replace("@image_res", "file:///android_res/drawable/image0.png");
//        html = html.replace("@image_file", "file://" + folder + "image0.png");
//
        String baseurl = "file:///android_asset/html/";
//
        mLog.e("WebViewActivity:baseurl=" + baseurl);
//        mLogUtil.e("WebViewActivity:转化之后的html="+html);


        webView.loadDataWithBaseURL(baseurl, html, "text/html", "UTF-8", null);
    }
}
